import { IsNotEmpty, IsString, Length } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class SignonDto {
  @ApiProperty({ description: '用户名' })
  @IsString({ message: 'username is not string' })
  @IsNotEmpty({ message: '用户名不能为空' })
  phone: string;

  @ApiProperty({ description: '密码' })
  @IsString({ message: 'password is not string' })
  @IsNotEmpty({ message: '密码不能为空' })
  password: string;

  @ApiProperty({ description: '验证码' })
  @IsString({ message: 'captcha is not string' })
  @IsNotEmpty({ message: '验证码不能为空' })
  @Length(4, 4, { message: '验证码长度为4位' })
  captcha: string;
}
